<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%
	String huanxinaccount=(String)session.getAttribute("huanxinaccount");
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="shortcut icon" href="/pic/pix/Hospital.jpg"> <!-- 这是页面的标题图标，可更换自己需要的icon-->
<link href="${pageContext.request.contextPath}/bootstrapStyle/css/bootstrap.min.css?v=3.3.5" rel="stylesheet">
<link href="${pageContext.request.contextPath}/bootstrapStyle/css/font-awesome.min.css?v=4.4.0" rel="stylesheet">
<link href="${pageContext.request.contextPath}/bootstrapStyle/css/animate.min.css" rel="stylesheet">
<link href="${pageContext.request.contextPath}/bootstrapStyle/css/style.min.css?v=4.0.0" rel="stylesheet">
<link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath }/bootstrapStyle/css/jquery-confirm.css"/>
<link href="${pageContext.request.contextPath}/bootstrapStyle/css/plugins/toastr/toastr.min.css" rel="stylesheet">
<title>前台主界面</title>
</head>
<body class="fixed-sidebar full-height-layout white-bg" style="overflow:hidden">
	<div id="wrapper">
        <!--左侧导航开始-->
        <nav class="navbar-default navbar-static-side" role="navigation">
            <div class="nav-close"><i class="fa fa-times-circle"></i>
            </div>
            <div class="sidebar-collapse">
                <ul class="nav" id="side-menu">
                    <li class="nav-header">
                        <div class="dropdown profile-element">
                            <a data-toggle="dropdown" class="dropdown-toggle" href="">
                            	<span><img alt="image" class="img-rounded m-t-xs img-responsive" src="${sessionScope.get('hosploginpix')}" style="width: 120px"/></span>
                                <span class="clear" >
	                               	<span class="block m-t-xs">
	                               		<strong class="font-bold">
	                               			&nbsp;&nbsp;&nbsp;&nbsp;${sessionScope.get('hosploginphone')}
	                               		</strong>
	                              	</span>
                                </span>
                            </a>
                            <ul class="dropdown-menu animated fadeInRight m-t-xs">
                                <%-- <li><a class="J_menuItem" href="${pageContext.request.contextPath }/Main/changePix.action">修改头像</a></li> --%>
                                <li><a class="J_menuItem" href="${pageContext.request.contextPath }/Main/myinfo/MyInformation.action">个人资料</a></li>
                                <%-- <li><a class="J_menuItem" href="${pageContext.request.contextPath }/Main/changePas.action">修改密码</a></li> --%>
                                <li><a href="#" onclick="Logout()">安全退出</a></li>
                            </ul>
                        </div>
                    </li>
                    <li>
                        <a href="#">
                            <i class="fa fa-navicon"></i>
                            <span class="nav-label">病房信息管理</span>
                            <span class="fa arrow"></span>
                        </a>
                        <ul class="nav nav-second-level">
                            <li>
                                <a class="J_menuItem" href="${pageContext.request.contextPath}/Main/Berth/berthset.action">病房管理</a>
                            </li>
                        </ul>
                    </li>
                    <li>
                        <a href="#">
	                        <i class="fa fa-dollar"></i>
	                        <span class="nav-label">项目管理</span>
	                        <span class="fa arrow"></span>
                        </a>
                        <ul class="nav nav-second-level">
                            <li>
                            	<a class="J_menuItem" href="${pageContext.request.contextPath}/Main/unitpriceMan/unitpriceSet.action">录入项目</a>
                            </li>
                            <li>
                            	<a class="J_menuItem" href="${pageContext.request.contextPath }/Main/unitpriceMan/unitpriceList.action">项目管理</a>
                            </li>
                        </ul>
                    </li>
                    <li>
                        <a href="#">
                            <i class="fa fa-recycle"></i>
                            <span class="nav-label">套餐管理</span>
                            <span class="fa arrow"></span>
                        </a>
                        <ul class="nav nav-second-level">
                            <li>
                                <a class="J_menuItem" href="${pageContext.request.contextPath}/Main/packageMan/packageSet.action">定制套餐</a>
                            </li>
                            <li>
                                <a class="J_menuItem" href="${pageContext.request.contextPath}/Main/packageMan/packageList.action">套餐管理</a>
                            </li>
                        </ul>
                    </li>
                    <li>
                        <a href="#">
	                        <i class="fa fa-stethoscope"></i>
							<span class="nav-label">找专家</span>
							<span class="fa arrow"></span>
						</a>
                        <ul class="nav nav-second-level">
                            <li>
                            	<a class="J_menuItem" href="${pageContext.request.contextPath}/Main/doctor/publishillness.action">找专家</a>
                            </li>
                            <li>
                            	<a class="J_menuItem" href="${pageContext.request.contextPath}/Main/doctor/myorder.action">我的专家会诊记录</a>
                            </li>
                        </ul>
                    </li>
                    <li>
                        <a href="#">
	                        <i class="fa fa-edit"></i>
							<span class="nav-label">订单管理</span>
							<span class="fa arrow"></span>
						</a>
                        <ul class="nav nav-second-level">
                            <li>
                            	<a class="J_menuItem" href="${pageContext.request.contextPath }/Main/OrderMan/MyOrder.action">我的订单</a>
                            </li>
                            <li>
                            	<a class="J_menuItem" href="${pageContext.request.contextPath }/Main/OrderMan/OrderSettle.action">订单结算</a>
                            </li>
                        </ul>
                    </li>
                    <li>
                        <a href="#">
	                        <i class="fa fa-hospital-o"></i>
	                        <span class="nav-label">我的医院</span>
	                        <span class="fa arrow"></span>
                        </a>
                        <ul class="nav nav-second-level">
                            <li>
                            	<a class="J_menuItem" href="${pageContext.request.contextPath}/Main/myinfo/MyInformation.action">我的信息</a>
                            </li>
                            <li>
                            	<a class="J_menuItem" href="${pageContext.request.contextPath}/Main/NoneRegisterMain/myhospitalReg.action">资料填写</a>
                            </li>
                            <li>
                            	<a class="J_menuItem" href="${pageContext.request.contextPath}/Main/myinfo/TradeRecordList.action">我的交易记录</a>
                            </li>
                            <li>
                            	<a class="J_menuItem" href="${pageContext.request.contextPath}/Main/myinfo/BalanceRecordList.action">我的余额变动记录</a>
                            </li>
                        </ul>
                    </li>
                    <li>
                        <a href="#">
	                        <i class="fa fa-hospital-o"></i>
	                        <span class="nav-label">消息管理</span>
	                        <span class="fa arrow"></span>
                        </a>
                        <ul class="nav nav-second-level">
                            <li>
                            	<a class="J_menuItem" href="${pageContext.request.contextPath}/Main/MyMessageMan/MySendedMessage.action">我发送的消息</a>
                            </li>
                            <li>
                            	<a class="J_menuItem" href="${pageContext.request.contextPath}/Main/MyMessageMan/MyReceivedMessage.action">我接收的消息</a>
                            </li>
                            <%-- <li>
                            	<a class="J_menuItem" href="${pageContext.request.contextPath}/Main/Test/alipayTest.action">支付宝测试</a>
                            </li> --%>
                        </ul>
                    </li>
                </ul>
            </div>
        </nav>
        <!--左侧导航结束-->
        
        <!--右侧部分开始-->
        <div id="page-wrapper" class="gray-bg dashbard-1">
            <div class="row border-bottom">
                <nav class="navbar navbar-static-top" role="navigation" style="margin-bottom: 0">
                    <div class="navbar-header"><a class="navbar-minimalize minimalize-styl-2 btn btn-primary " href="#"><i class="fa fa-bars"></i>收起菜单</a></div>
                    <ul class="nav navbar-top-links navbar-right">
                    <!-- <button onclick="CloseToastr()" class="btn btn-primary">关闭通知</button>
                    <button onclick="OpenToastr()" class="btn btn-primary">开启通知</button> -->
                    	<li class="dropdown">
                            <a class="J_menuItem dropdown-toggle count-info" data-toggle="dropdown" onclick="CheckMessage();" href="${pageContext.request.contextPath}/Main/MyMessageMan/MyReceivedMessage.action">
                               	 消息管理<i class="fa fa-envelope"></i> <span class="label label-info" id="messagetotal"></span>
                            </a>
                        </li>
                        <li class="dropdown hidden-xs">
                            <a class="right-sidebar-toggle" aria-expanded="false">
                                <i class="fa fa-tasks"></i> 主题
                            </a>
                        </li>
                    </ul>
                </nav>
            </div>
            <div class="row content-tabs">
                <button class="roll-nav roll-left J_tabLeft"><i class="fa fa-backward"></i>
                </button>
                <nav class="page-tabs J_menuTabs">
                    <div class="page-tabs-content">
                        <a href="javascript:;" class="active J_menuTab" href="">首页</a>
                    </div>
                </nav>
                <button class="roll-nav roll-right J_tabRight"><i class="fa fa-forward"></i></button>
                <div class="btn-group roll-nav roll-right">
                    <button class="dropdown J_tabClose" data-toggle="dropdown">关闭操作<span class="caret"></span></button>
                    <ul role="menu" class="dropdown-menu dropdown-menu-right">
                        <li class="J_tabShowActive"><a>定位当前选项卡</a>
                        </li>
                        <li class="divider"></li>
                        <li class="J_tabCloseAll"><a>关闭全部选项卡</a>
                        </li>
                        <li class="J_tabCloseOther"><a>关闭其他选项卡</a>
                        </li>
                    </ul>
                </div>
                <a href="#" onclick="Logout()" class="roll-nav roll-right J_tabExit"><i class="fa fa fa-sign-out"></i> 退出</a>
            </div>
            <div class="row J_mainContent" id="content-main">
                <iframe class="J_iframe" name="iframe0" width="100%" height="100%" src="${pageContext.request.contextPath}/Main/myinfo/MyInformation.action" frameborder="0" seamless>
	            	
                </iframe>
            </div>
        </div>
        <!--右侧部分结束-->
        
        <!--右侧边栏开始-->
        <div id="right-sidebar">
            <div class="sidebar-container">
                <ul class="nav nav-tabs navs-3">
                    <li class="active">
                        <a data-toggle="tab" href="#tab-1"><i class="fa fa-gear"></i>主题</a>
                    </li>
                    <li class="">
                    	<a data-toggle="tab" href="#tab-2">通知</a>
                    </li>
                    <!-- <li>
                    	<a data-toggle="tab" href="#tab-3"> 项目进度</a>
                    </li> -->
                </ul>
                <div class="tab-content">
                	<!-- 主题里的tab1的div -->
                    <div id="tab-1" class="tab-pane active">
                        <div class="skin-setttings">
                            <div class="title">主题设置</div>
                            <div class="setings-item">
                                <span>收起左侧菜单</span>
                                <div class="switch">
                                    <div class="onoffswitch">
                                        <input type="checkbox" name="collapsemenu" class="onoffswitch-checkbox" id="collapsemenu">
                                        <label class="onoffswitch-label" for="collapsemenu">
                                            <span class="onoffswitch-inner"></span>
                                            <span class="onoffswitch-switch"></span>
                                        </label>
                                    </div>
                                </div>
                            </div>
                            <div class="setings-item">
                                <span>固定顶部</span>
                                <div class="switch">
                                    <div class="onoffswitch">
                                        <input type="checkbox" name="fixednavbar" class="onoffswitch-checkbox" id="fixednavbar">
                                        <label class="onoffswitch-label" for="fixednavbar">
                                            <span class="onoffswitch-inner"></span>
                                            <span class="onoffswitch-switch"></span>
                                        </label>
                                    </div>
                                </div>
                            </div>
                            <div class="setings-item">
                                <span>固定宽度</span>
                                <div class="switch">
                                    <div class="onoffswitch">
                                        <input type="checkbox" name="boxedlayout" class="onoffswitch-checkbox" id="boxedlayout">
                                        <label class="onoffswitch-label" for="boxedlayout">
                                            <span class="onoffswitch-inner"></span>
                                            <span class="onoffswitch-switch"></span>
                                        </label>
                                    </div>
                                </div>
                            </div>
                            <div class="title">皮肤选择</div>
                            <div class="setings-item default-skin nb">
                            	<span class="skin-name ">
                         			<a href="#" class="s-skin-0">默认皮肤</a>
                    			</span>
                            </div>
                            <div class="setings-item blue-skin nb">
                                <span class="skin-name ">
                        			<a href="#" class="s-skin-1">蓝色主题</a>
                    			</span>
                            </div>
                            <div class="setings-item yellow-skin nb">
                                <span class="skin-name ">
                        			<a href="#" class="s-skin-3">黄色/紫色主题</a>
                    			</span>
                            </div>
                        </div>
                    </div>
                    <!-- 主题里的tab2的div -->
                    <div id="tab-2" class="tab-pane">
                        <div>
                            <div class="sidebar-message">
                                <a href="#">
                                    <div class="pull-left text-center">
                                        <img alt="image" class="img-circle message-avatar" src="${pageContext.request.contextPath}/bootstrapStyle/img/a1.jpg">
                                        <div class="m-t-xs">
                                            <i class="fa fa-star text-warning"></i>
                                            <i class="fa fa-star text-warning"></i>
                                        </div>
                                    </div>
                                    <div class="media-body" id="showmessage"> 通知内容！！！
                                        <br>
                                        <small class="text-muted">今天 16:51</small>
                                    </div>
                                </a>
                           	</div>
                        </div>
                    </div>
                    <!-- 主题里的tab3的div -->
                    <div id="tab-3" class="tab-pane">
                    </div>
                </div>
            </div>
        </div>
        <!--右侧边栏结束-->
        <!-- <div class="footer" style="height:165px;">
				<div class="container">
					<div class="row footer-top">
			            <div class="col-sm-6 col-lg-6">
			                <h4></h4>
			                <p>欢迎您加入，这里有你想要的.</p>
			            </div>
			            <div class="col-sm-6  col-lg-5 col-lg-offset-1">
			                <div class="row about">
			                    <div class="col-xs-3">
			                        <h4>关于</h4>
			                        <ul class="list-unstyled">
			                            <li>
			                                <a href="#">关于我们</a>
			                            </li>
			                        </ul>
			                    </div>
			                    <div class="col-xs-3">
			                        <h4>联系方式</h4>
			                        <ul class="list-unstyled">
			                            <li>
			                                <a title="云梦网官方微博" href="#">新浪微博</a>
			                            </li>
			                            <li>
			                                <a href="#">电子邮件</a>
			                            </li>
			                        </ul>
			                    </div>
			                </div>
			            </div>
			        </div>
			        <hr>
			        <div class="row footer-bottom">
			            <ul class="list-inline text-center">
			                <li>Copyright &copy;2017. n 安徽大学——LTT-AH-ZY Software All Rights Reserved.</li>
			            </ul>
			        </div>
    			</div>
			</div> -->
    </div>
    <script src="${pageContext.request.contextPath}/bootstrapStyle/js/jquery.min.js?v=2.1.4"></script>
    <script src="${pageContext.request.contextPath}/bootstrapStyle/js/bootstrap.min.js?v=3.3.5"></script>
    <script src="${pageContext.request.contextPath}/bootstrapStyle/js/plugins/metisMenu/jquery.metisMenu.js"></script>
    <script src="${pageContext.request.contextPath}/bootstrapStyle/js/plugins/slimscroll/jquery.slimscroll.min.js"></script>
    <script src="${pageContext.request.contextPath}/bootstrapStyle/js/plugins/layer/layer.min.js"></script>
    <script src="${pageContext.request.contextPath}/bootstrapStyle/js/hplus.min.js?v=4.0.0"></script>
    <script src="${pageContext.request.contextPath}/bootstrapStyle/js/contabs.min.js"></script>
    <script src="${pageContext.request.contextPath}/bootstrapStyle/js/plugins/pace/pace.min.js"></script>
    <script src="${pageContext.request.contextPath }/bootstrapStyle/js/jquery-confirm.js"></script>
    <script src="${pageContext.request.contextPath }/bootstrapStyle/js/plugins/toastr/toastr.min.js"></script>
    <script type="text/javascript" src="${pageContext.request.contextPath }/js/websocket.js"></script> 
    <script type="text/javascript">
	    $(function(){
	    	getMessagetotal();
	    })
    	function Logout(){
    		$.confirm({
    		    title: '提示!',
    		    content: '你确定要退出？',
    		    type: 'red',
    		    typeAnimated: true,
    		    buttons: {
    		    	确定: function () {
    		    		window.location.href="${pageContext.request.contextPath}/Login/logoutsubmit.action";
    		    	},
    				取消: function () {},
    		    }	
    		});
    	}
    	function getMessagetotal(){
    		$.ajax({
    			type:"post",
    			url:"${pageContext.request.contextPath}/Main/getmessagetotal.action",
        		async: true,
                success:function(data){
                	if(data.code==100){
                		if(data.number==0){
                			$("#messagetotal").text("");       			
                		}else{
	                		$("#messagetotal").text(data.number);
                		}
                	}
                },error:function(request){
                	$.alert('获取未读消息数量出错了！');
                }
    		})
    	}
    	function CheckMessage(){
        	//$("#messagetotal").text("");
    		getMessagetotal();
        }
    	/* function GetMessage(){
    		var msg='test';//提示消息内容
    		var title="测试用例标题";//提示消息的标题
    		$.ajax({
    			type:"post",
    			url:"${pageContext.request.contextPath}/Main/OrderMan/NewMessage.action",
    			contentType:"application/json;charset=utf-8",
        		async: true,
                success:function(data){
                	//alert("data.code:"+data.code+" | data.title:"+data.title+" | data.msg:"+data.msg);
                	var type=1;
                	msg=data.msg;
                	title=data.title;
                	ToaStrShow(type,title,msg);
                	var total = parseInt($("#messagetotal").text());
                	var newtotal = total+1;
                	$("#messagetotal").text(newtotal);
                        //var test = $("#showmessage").after('<a class="J_menuItem" href="${pageContext.request.contextPath}/Main/NoneRegisterMain/myhospitalReg.action">测试用例</a>');
                        //$.parser.parse(test);
                },error:function(request){
                	alert('获取新消息失败！');
                }
    		})
    	} */
    	function ToaStrShow(title,msg){
    		toastr.options = {
                    closeButton: true, //显示关闭按钮
                    debug: false, //启用debug
                    progressBar:true,//是否显示进度条
                    positionClass: "toast-bottom-right",//弹出的位置
                    showDuration: "300",//显示的时间
                    hideDuration: "5000",//消失的时间
                    timeOut: "50000", //停留的时间
                    extendedTimeOut: "50000",//控制时间
                    showEasing: "swing",//显示时的动画缓冲方式
                    hideEasing: "linear",//消失时的动画缓冲方式
                    showMethod: "fadeIn",//显示时的动画方式
                    hideMethod: "fadeOut", //消失时的动画方式
                    onclick:function(){
                    	$.alert(msg);
                    }
            };
    		toastr.info(msg,title);
    		/* if(type==1){
    			toastr.info(msg,title);
    		}else if(type==2){
    			toastr.success(msg,title);
    		}else if(type==3){
    			toastr.warning(msg,title);
    		}else if(type==4){
    			toastr.error(msg,title);
    		} */
    	}
    </script>
    <script type="text/javascript">  
    var websocket = null;  
    if ('WebSocket' in window) {  
        //Websocket的连接  
        websocket = new WebSocket("ws://118.89.172.204:6221/internetmedical/websocket/socketServer/<%=huanxinaccount%>");//WebSocket对应的地址  
    }  
    else if ('MozWebSocket' in window) {  
        //Websocket的连接  
        websocket = new MozWebSocket("ws://118.89.172.204:6221/internetmedical/websocket/socketServer/<%=huanxinaccount%>");//SockJS对应的地址  
    }  
    else {  
        //SockJS的连接  
        websocket = new SockJS("http://118.89.172.204:6221/internetmedical/sockjs/socketServer/<%=huanxinaccount%>");    //SockJS对应的地址  
    }  
    websocket.onopen = onOpen;  
    websocket.onmessage = onMessage;  
    websocket.onerror = onError;  
    websocket.onclose = onClose;  
  
    function onOpen(openEvt) {  
        //alert(openEvt.Data);  
    }  
  
    
    function onMessage(evt) {  
        //alert(evt.data);  
        ToaStrShow("新消息提醒",evt.data);
        var mestotal = $("#messagetotal").text();
        if(mestotal==""){
        	mestotal=0;
        }
        var total = parseInt(mestotal);
    	var newtotal = total+1;
    	$("#messagetotal").text(newtotal);
    }  
    function onError() {  
    }  
    function onClose() {  
    }
    
    window.close = function () {  
        websocket.onclose();  
    }  
</script>  
</body>
</html>